home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: strings from VB?
- Date: 19 Jan 1996 08:30:03 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4dnkqb$ngn@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 18, 1996 16:50:52 in article <strings from VB?>, 'Gooding
- <mgooding@wolfenet.com>' wrote:
-
-
- >How does Visual Basic pass strings to functions in a DLL?
-
- By reference (address).
-
- Declare your DLL function in your VB module something like:
-
- Declare Function MyFunc Lib "MYDLL.DLL" (ByVal s as String) as integer
-
- (Note the ByVal)
-
- Sub Foo ()
- Dim Bar as String
- dim lgth as Integer
- Bar = "Now is the time for all good ..."
- lgth = MyFunc(Bar)
-
- If the DLL to writes to a buffer, do something like:
-
- Sub Bleep ()
- Dim Grumpy as String * 75
- lgth = MyOtherFunc (Grumpy, 75)
-
- Have the DLL return the length of the string and within your
- VB code, adjust the string's length to the returned value.
-
-
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-